package com.cuit.mimall.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cuit.mimall.entity.SeckillProduct;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author TeaWu
 * @since 2023-07-04
 */
public interface SeckillProductMapper extends BaseMapper<SeckillProduct> {
    @Update("update seckill_product set seckill_stock = seckill_stock - 1 where seckill_id = #{seckillId} and seckill_stock > 0")
    void decrStock(Integer seckillId);

    @Delete("delete from seckill_product")
    void deleteAll();
}
